<template>
  <div id="app">
      <div class="header">
        <h3>限时秒杀</h3>
        <div class="redbao">
      <div class="red">
        <div class="r1">热抢中</div>
        <div class="r2">00:00</div>
      </div>
      <div class="red">
        <div class="r1">即将开抢</div>
        <div class="r2">00:00</div>
      </div>
      <div class="red">
        <div class="r1">即将开抢</div>
        <div class="r2">11:00</div>
      </div>
            <div class="red">
        <div class="r1">即将开抢</div>
        <div class="r2">13:00</div>
      </div>
      <div class="red">
        <div class="r1">即将开抢</div>
        <div class="r2">16:00</div>
      </div>
      <div class="red">
        <div class="r1">即将开抢</div>
        <div class="r2">18:00</div>
      </div>
     
    </div>
    <div class="da"> <img src="../../public/da.png" alt=""></div>
        <div class="wenzi">
            <span v-for="(item,index) in list" :class="{active:currentIndex==index}"  @click="delivery(index)" :key="index">{{item.name}}</span>
        </div>
      </div>
  <div class="bbt">
  <div class="shoplist">
      <div v-for="(item,index) in list[currentIndex].goodlist" :key="index"  class="shop">
          <div class="img-box">
              <img :src="item.pic" alt="">
          </div>
          <div class="text">
              <div class="name">{{item.name}}</div>
              <div class="goodname">{{item.goodname}}</div>
              <div class="price">￥{{item.price}}<span>{{item.zhekou}}</span></div>
          </div>
          <div class="btn">
              <button>马上抢</button>
          </div>
          <div class="xiaoliang">
            <div class="old_price">￥{{item.old_price}}</div>
            <div class="count">已售{{item.count}}份</div>
          </div>
      </div>
  </div>
  </div>  

  </div>   
  </template>
  
  
  <script>

  export default {
    data() {
      return {
        currentIndex: 0,
        list: [
          {
          name: "正在抢购",
          goodlist: [
            {
              id: 1,
              name: "汉堡王 | 北美新天地餐厅",
              goodname: "买1送1明星皇堡 | 用心火烤肉质紧实 鲜嫩多汁 爆爆团",
              pic: "./b1.jpg",
              price: 25,
              old_price: 50,
              zhekou: "5折",
              count: 9029
            },
            {
              id: 2,
              name: "华莱士 | 长治路店",
              goodname: "华莱士 | 聚划算单人套餐 | 进店必选",
              pic: "./b2.jpg",
              price: 12.12,
              old_price: 31.2,
              zhekou: "3.9折",
              count: 173
            },
            {
              id: 3,
              name: "贡天下山西特产 | 高新店",
              goodname: " 白老大小米果仁酥220g【爆爆团】",
              pic: "./b3.png",
              price: 8.8,
              old_price: 17.6,
              zhekou: "5折",
              count: 658
            }
          ]
        },
        {
          name: "上新预告",
          goodlist: [
            {
              id: 1,
              name: "汉堡王 | 杭州新天地餐厅",
              goodname: "买1送1 | 用心火烤肉质紧实 鲜嫩多汁 爆爆团",
              pic: "./b1.jpg",
              price: 45,
              old_price: 50,
              zhekou: "95折",
              count: 9029
            },
            {
              id: 2,
              name: "华莱士 | 青松店",
              goodname: "华莱士 | 聚划算单人套餐 | 进店必选",
              pic: "./b2.jpg",
              price: 15.5,
              old_price: 31.2,
              zhekou: "3.9折",
              count: 173
            },
            {
              id: 3,
              name: "贡天下山西特产 | 小寨店",
              goodname: " 白老大小米果仁酥220g【爆爆团】",
              pic: "./b3.png",
              price: 7.8,
              old_price: 17.6,
              zhekou: "5折",
              count: 658
            }
          ]
        }],
      };
    },
   
    methods:{
      delivery(index){
        this.currentIndex=index;
      }
    }
  };
  </script>
  
  
  <style scoped>
  .header {
   
    width: 100%;
    height: 290px;
    position: relative;
    
  }
  h3{
   margin: 0px;
text-align: center;
  }
  .redbao{
  display: flex;
  justify-content: space-around;
  padding:  10px 2px;
}  .red{
  padding: 3px;
  margin-left: 4px;
  background-color: #fff;
   border-radius: 10px;
    text-align: center;
    border:1px solid rgb(167, 165, 165);;
    
  }
  .red:nth-child(1){
    background-color: rgb(246, 38, 38);
    color: white;
    margin-left: 2px;
  }
  .r1{
      font-size: 12px;
      margin-bottom: 8px;
    }
    .r2{
      font-size: 16px;
      font-weight: 600;
    }
.da{
  width: 300px;
  margin-left:10px ;
}
.da img{
  width: 340px; height: 155px;
}
    .wenzi {
      height: 40px;
      width: 200px;
      position: absolute;
      left: 30px;
      bottom: -8px;
      
    }
    .wenzi span {
        font-size: 20px;
        margin-right: 20px;
      }
      .wenzi span.active{
        border-bottom: 2px solid ;
      }
  /* .bbt {
    padding: 20px 0;
  } */
  .shoplist {
    display: flex;
    flex-direction: column;
    padding: 5px;
    background-color: white;
  }
  .shop {
    box-sizing: border-box;
    margin: 0 auto;
    padding: 0px;
    width: 100%;
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
  }
  .shop .img-box {
      width: 100px;
      
    }
    .shop .img-box img {
        width: 100%;
      }
    .shop .text {
      flex: 1;
      font-size: 12px;
      margin-left: 10px;
      
    }.shop .text .name {
        color: grey;
      }
      .shoplist  .text .goodname {
        margin-top: 5px;
        width: 200px;
        font-size: 14px;
        font-weight: bold;
        margin-bottom: 5px;
      }
      .shop .text .price {
        font-size: 20px;
        color: red;
        margin-bottom: 10px;
        font-weight: bold;
      }
      .shop .text  span {
        border: 1px solid red;
        text-align: center;
        color: red;
        border-radius: 5px;
        padding: 2px 5px;
        margin-left: 10px;
        font-weight: normal;
        font-size: 16px;
      }
      .shoplist .btn button {
      position: absolute;
      right: 2px;
      bottom:7px;
      width: 90px;
      height: 35px;
      text-align: center;
      line-height: 35px;
      background-color: red;
      color: white;
      border: none;
      border-radius: 20px;
      font-size: 16px;
      font-weight: bold;
    }
    .xiaoliang {
      width: 100%;
      position: absolute;
      left: 0;
      bottom: -15px;
      display: flex;
      justify-content: space-between;
     
    }  
    .xiaoliang .old_price {
        margin-left: 120px;
        color: gray;
        font-size: 12px;
      }
      .xiaoliang  .count {
        margin-right: 10px;
        color: red;
        font-size: 14px;
      }
  </style>
  